package com.dys.testproject;

/**
 * @className: com.dys.testproject.BaconPizza
 * @description: 培根披萨
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/07/22 下午10:50
 */
public class BaconPizza extends BasePizzeria {
    private double gram;

    public BaconPizza() {
    }

    public BaconPizza(double gram) {
        this.gram = gram;
    }

    public BaconPizza(String name, int size, double price, double gram) {
        super(name, size, price);
        this.setGram(gram);
    }

    public double getGram() {
        return gram;
    }

    public void setGram(double gram) {
        if (gram < 0) {
            throw new RuntimeException("克数不能为负");
        }
        this.gram = gram;
    }

    @Override
    public String show() {
        return super.show() + "\n培根克数: " + this.gram + "克";
    }
}
